package com.lcl.jarvis.service.impl;

import java.util.List;
import java.util.Map;

import com.lcl.jarvis.dto.TbUserAuthQueryDTO;
import com.lcl.jarvis.dto.TbUserAuthDTO;
import com.lcl.jarvis.bo.TbUserAuthBO;
import com.lcl.jarvis.service.TbUserAuthService;

import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author licl
 * @since 2024-05-16
 */
@Service
public class TbUserAuthServiceImpl implements TbUserAuthService {


    private final TbUserAuthBO tbUserAuthBO;

    @Autowired
    public TbUserAuthServiceImpl(TbUserAuthBO tbUserAuthBO){
        this.tbUserAuthBO = tbUserAuthBO;
    }

    /**
     * 简单分页查询
     *
     * @param pageNumber 页码
     * @param pageSize 每页数量
     * @param sort 正序/倒序
     * @param order 排序字段-属性名
     * @param tbUserAuth
     * @return
     */
    @Override
	public Map<String, Object> queryPage(TbUserAuthQueryDTO tbUserAuth) {
    	return tbUserAuthBO.queryByDTOPage(tbUserAuth);
	}

    /**
     * 查询所有信息
     *
     * @param tbUserAuth 参数 TbUserAuthQueryDTO 对象
     * @return 对象List
     */
    @Override
    public List<TbUserAuthDTO> queryAll(TbUserAuthQueryDTO tbUserAuth) {
        return tbUserAuthBO.queryByDTO(tbUserAuth);
    }

    /**
     * 通过ID查询
     *
     * @param id ID
     * @return TbUserAuth
     */
    @Override
    public TbUserAuthDTO queryById(String id) {
        return tbUserAuthBO.getById(id);
    }


    /**
     * 添加
     *
     * @param tbUserAuth DTO
     * @return TbUserAuthDTO
     */
    @Override
    public TbUserAuthDTO save(TbUserAuthDTO tbUserAuth) {
        return tbUserAuthBO.save(tbUserAuth);
    }

    /**
     * 更新
     *
     * @param tbUserAuth DTO
     * @return TbUserAuthDTO
     */
    @Override
    public TbUserAuthDTO update(TbUserAuthDTO tbUserAuth) {
        return tbUserAuthBO.updateById(tbUserAuth);
    }

    /**
     * 删除
     *
     * @param id 主键
     */
    @Override
    public void delete(String id) {
        tbUserAuthBO.delete(id);
    }

    @Override
    public TbUserAuthDTO queryUserByUsername(TbUserAuthQueryDTO tbUserAuthDto) {
        return tbUserAuthBO.queryUserByUsername(tbUserAuthDto);
    }
}
